﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using UcAsp.Net.Interface;
namespace UcAsp.Net.Extract.Plug.ExpressNo
{
    public partial class UcAspControl : UserControl,IExtract
    {
        private DateTime _adddatetime = DateTime.Now;
        public UcAspControl()
        {
            InitializeComponent();
        }
        #region 属性
        /// <summary>
        /// 常规项
        /// </summary>
        /// 
        public string Security { get; set; }
       public  string Image { get; set; }
        public int ID { get; set; }
        public string Title { get; set; }
        public string Tag { get; set; }
        public string IconUrl { get; set; }
        public string ArticleContent { get; set; }
        public string MetaKeyword { get; set; }
        public string MetaDescrition { get; set; }
        public string Description { get; set; }
        public DateTime AddDatetime { get { return this._adddatetime; } set { this._adddatetime = value; } }
        public bool IsRelease { get; set; }
        public bool IsRecommend { get; set; }
        public int Hot { get; set; }
        public int Rate { get; set; }
        public int CategorieID { get; set; }
        public string ShowPath { get; set; }
        public string ViewsTemp { get; set; }
        public int UserID { get; set; }
        public int Rank { get; set; }

        /// <summary>
        /// 可变文字项
        /// </summary>
        public string Note1 { get; set; }
        public string Note2 { get; set; }
        public string Note3 { get; set; }
        public string Note4 { get; set; }
        public string Note5 { get; set; }
        public string Note6 { get; set; }
        public string Note7 { get; set; }
        public string Note8 { get; set; }
        public string Note9 { get; set; }
        /// <summary>
        /// 可变数组项
        /// </summary>
        public int Int1 { get; set; }
        public int Int2 { get; set; }
        public int Int3 { get; set; }
        public int Int4 { get; set; }
        public int Int5 { get; set; }


        public double Float1 { get; set; }
        public double Float2 { get; set; }
        public double Float3 { get; set; }
        public double Float4 { get; set; }
        public double Float5 { get; set; }


        public DateTime Date1 { get; set; }
        public DateTime Date2 { get; set; }
        public DateTime Date3 { get; set; }
        public DateTime Date4 { get; set; }
        public DateTime Date5 { get; set; }
        public DateTime Date6 { get; set; }
        public DateTime Date7 { get; set; }
        public DateTime Date8 { get; set; }
        public int PageCount { get; set; }
        #endregion
        public virtual bool Execute(object id)
        { return true; }
        public virtual object Init() { return new bool(); }
        public event EventHandler Save;
        public event EventHandler SavePage;
        public event EventHandler SaveImage;
        private void Save_Click(object sender, EventArgs e)
        {
            if (Save != null)
            {
                string content = rtbExpressNo.Text;
                string[] list = content.Split('\n');
                for (int i = 0; i < list.Length; i++)
                {
                    string[] express = list[i].Split('\t');
                    Title = express[0]; Note1 = express[1]; Note2 = express[2]; Note3 = express[3]; Note4 = express[4]; Note5 = express[5]; Note6 = express[6]; Note7 = express[7]; Date1 = DateTime.Parse(express[8]); AddDatetime = DateTime.Now; CategorieID = 56; IsRelease = true;
                    Save(this, EventArgs.Empty);
                    ID = 0;
                }
                
            }
            
        }

        private void UcAspControl_Load(object sender, EventArgs e)
        {
            this.Width = this.Parent.Width;
            this.Height = this.Parent.Height;
        }

        private void UcAspControl_SizeChanged(object sender, EventArgs e)
        {
            this.Width = this.Parent.Width;
            this.Height = this.Parent.Height;
        }

        private void UcAspControl_Resize(object sender, EventArgs e)
        {
            this.Width = this.Parent.Width;
            this.Height = this.Parent.Height;
        }
    }
}
